package com.github.androiddevelopmentframework;

import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.GridView;
import android.widget.ListView;

import com.github.freewu.commons.utils.AdapterViewUtils;
import com.github.freewu.mvp.presenter.Presenter;
import com.github.freewu.mvp.view.BaseActivity;
import com.joanzapata.android.BaseAdapterHelper;
import com.joanzapata.android.QuickAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by free on 16-9-6.
 */
public class AdapterActivity extends BaseActivity {
    private ListView listView;

    private GridView gridView;

    @Override
    public int getLayout() {
        return R.layout.adapter_view_layout;
    }

    @Override
    public void initView(View mView) {
        listView =(ListView)mView.findViewById(R.id.listView);

        gridView=(GridView)mView.findViewById(R.id.gridView);

        List<String> weeks_list=new ArrayList<String>();
        weeks_list.add("周一");
        weeks_list.add("周二");
        weeks_list.add("周三");
        weeks_list.add("周四");
        weeks_list.add("周五");
        weeks_list.add("周六");
        weeks_list.add("周日");

        QuickAdapter<String> adapter=new QuickAdapter<String>(getContext(),R.layout.adapter_view_item,weeks_list) {
            @Override
            protected void convert(BaseAdapterHelper helper, String item) {
                   helper.setText(R.id.name,item);
            }
        };

        listView.setAdapter(adapter);
        gridView.setAdapter(adapter);

        AdapterViewUtils.setListViewHeightBasedOnChildren(listView);
        AdapterViewUtils.setGridViewHeightBasedOnChildren(gridView);
    }

    @Override
    public void initData() {

    }
}
